
package com.sawgdev.android.bokuiki.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;

import com.sawgdev.android.bokuiki.R;

public class ActMenu extends Activity {

    private ImageView menuMap;

    private ImageView menuHistory;

    private ImageView menuProfile;

    private ImageView menuHelp;

    private View.OnClickListener clickMenuMap = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), ActMap.class);
            startActivity(intent);
        }
    };

    private View.OnClickListener clickMenuHistory = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), ActHistory.class);
            startActivity(intent);
        }
    };

    private View.OnClickListener clickMenuProfile = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), ActProfile.class);
            startActivity(intent);
        }
    };

    private View.OnClickListener clickMenuHelp = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), ActHelp.class);
            startActivity(intent);
        }
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.menu);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        menu.add(Menu.NONE, 0, 0, R.string.option_menu_setting).setIcon(
                android.R.drawable.ic_menu_manage);
        menu.add(Menu.NONE, 1, 1, R.string.option_menu_help).setIcon(
                android.R.drawable.ic_menu_help);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case 0:
            	startActivity(new Intent(getApplicationContext(), ActSetting.class));
                break;
            case 1:
                startActivity(new Intent(getApplicationContext(), ActHelp.class));
                break;
            default:
                startActivity(new Intent(getApplicationContext(), ActSetting.class));
                break;
        }
        return true;
    }

    @Override
    protected void onResume() {
        super.onResume();
        menuMap = (ImageView) findViewById(R.id.menu_icon_map);
        menuHistory = (ImageView) findViewById(R.id.menu_icon_history);
        menuProfile = (ImageView) findViewById(R.id.menu_icon_profile);
        menuHelp = (ImageView) findViewById(R.id.menu_icon_help);
        menuMap.setOnClickListener(clickMenuMap);
        menuHistory.setOnClickListener(clickMenuHistory);
        menuProfile.setOnClickListener(clickMenuProfile);
        menuHelp.setOnClickListener(clickMenuHelp);
    }
}
